#pragma once
#include <iostream>
#include <unistd.h>
#include <pthread.h>
#include <string>
#include <stdarg.h>

using namespace std;

enum
{
    Debug = 0,
    Info,
    Warning,
    Error,
    Fatal
};

string LevelToString(int level)
{
    switch(level)
    {
        case Debug:
            return "Debug";
        case Info:
            return "Info";
        case Warning:
            return "Warning";
        case Error:
            return "Error";
        case Fatal:
            return "Fatal";
        default:
            return "Unkonw";
    }
}

class Log
{
public:
    Log()
    {}
    
    void LogMessage(int level, const char *format, ...) // 日志接口
    {
        char content[1024];
        va_list args;
        va_start(args, format);
        // args 指向了可变参数部分
        vsnprintf(content, sizeof(content), format, args);
        va_end(args);

        printf("[%s]: [%s]\n", LevelToString(level).c_str(), content);
    }

    ~Log()
    {}
private:

};